package com.qianfeng.iot.api;
//
//                            _ooOoo_  
//                           o8888888o  
//                           88" . "88  
//                           (| -_- |)  
//                            O\ = /O  
//                        ____/`---'\____  
//                      .   ' \\| |// `.  
//                       / \\||| : |||// \  
//                     / _||||| -:- |||||- \  
//                       | | \\\ - /// | |  
//                     | \_| ''\---/'' | |  
//                      \ .-\__ `-` ___/-. /  
//                   ___`. .' /--.--\ `. . __  
//                ."" '< `.___\_<|>_/___.' >'"".  
//               | | : `- \`.;`\ _ /`;.`/ - ` : | |  
//                 \ \ `-. \_ __\ /__ _/ .-` / /  
//         ======`-.____`-.___\_____/___.-`____.-'======  
//                            `=---='  
//  
//         .............................................  
//                  佛祖镇楼            BUG辟易  
//          佛曰:  
//                  写字楼里写字间，写字间里程序员；  
//                  程序人员写程序，又拿程序换酒钱。  
//                  酒醒只在网上坐，酒醉还来网下眠；  
//                  酒醉酒醒日复日，网上网下年复年。  
//                  但愿老死电脑间，不愿鞠躬老板前；  
//                  奔驰宝马贵者趣，公交自行程序员。  
//                  别人笑我忒疯癫，我笑自己命太贱；  


import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import reactivefeign.spring.config.ReactiveFeignClient;
import reactor.core.publisher.Mono;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * Created by jackiechan on 2022/10/31 15:29
 *
 * @author jackiechan
 * @version 1.0
 * @since 1.0
 */
@ReactiveFeignClient("iot-cache")
public interface CacheOpenfeignClient {


    @PostMapping("/cache/set/{key}/{value}")
     Mono<Boolean> set(@PathVariable String key, @PathVariable String value);

    @GetMapping("/cache/get/{key}")
     Mono<String> getValue(@PathVariable String key);

    @PostMapping("/cache/set/{key}/{value}/{expire}")
     Mono<Boolean> set(@PathVariable String key, @PathVariable String value,@PathVariable Long expire);

    @GetMapping("/cache/incrment/{key}/{delta}")
     Mono<Long> getValue(@PathVariable String key, @PathVariable Long delta) ;

    @PostMapping("/cache/nx/{key}/{value}")
     Mono<Boolean> setNX(@PathVariable String key, @PathVariable String value) ;

    @PostMapping("/cache/hset/{key}/{field}/{value}")
     Mono<Boolean> hSet(@PathVariable String key, @PathVariable String value,@PathVariable  String field );

    @PostMapping("/cache/hmset/{key}")
     Mono<Boolean> setNX(@PathVariable String key,@RequestBody Map values) ;

    @GetMapping("/cache/hvalues/{key}")
     Mono<Map> hGetAll(@PathVariable String key);


    @PostMapping("/cache/saddmemeber/{key}")
     Mono<Long> sAdd(@PathVariable String key, String value);

    @PostMapping("/cache/saddmemebers/{key}")
     Mono<Long> sAdd(@PathVariable String key, @RequestBody Set<String> members) ;


    @GetMapping("/cache/smembers/{key}")
     Mono<List<String>> sMembers(@PathVariable String key);

    @PostMapping("/cache/deletekeys")
    public Mono<Long> deleteKeys(@RequestBody String... keys);
}
